* Replication Code for
* Hitting Back or Holding Back in Cyberspace:
* Experimental Evidence Regarding Americans' Preferences for Responses to
* Cyberattacks

* Paul Musgrave (musgrave@umass.edu) for
* Marcelo Mesquita Leal and Paul Musgrave

* 1 June 2022
* 14 October 2022 updates


******************************************
* Introduction
******************************************

/*
This code produces replication charts and tables for "Hitting Back or Holding 
Back in Cyberspace". We have put together the charts and tables in approximately
the same order as shown in the appendix. The charts for the main text are noted
in the description (search for "Main Text").

Users will have to set the directory to their own version, obviously.

UPDATE: This corrects a minor code error regarding combining graphs.
*/

version 16
clear

set more off

global MyDocs /Users/paulmusgrave/Downloads/dataverse_files
global MyProject  "${MyDocs}"


use "${MyProject}/TheCyber2019AnalysisData.dta"

set scheme plotplainblind

******************************************
* Severity
******************************************

* No participant variables
quietly reg severe i.aggressororigin i.target b1.economic b1.death ///
	i.aggressortype  i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
    task choice, vce(cluster caseid)
eststo severem1

* Participant Variables

quietly reg severe i.aggressororigin i.target   b1.economic b1.death  ///
	i.aggressortype i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice, vce(cluster caseid)
eststo severem2

* Participant Variables and Preview Variables

quietly reg severe i.aggressororigin i.target b1.economic b1.death ///
	i.aggressortype i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice previewsevere previewnotsevere , vce(cluster caseid)
eststo severem3
	

* Participant Variables and Threat Variables

quietly reg severe i.aggressororigin i.target   b1.economic b1.death  ///
	i.aggressortype  i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice i.threatCyber , vce(cluster caseid)
eststo severem4
	
	
quietly reg severe i.aggressororigin i.target   b1.economic b1.death  ///
	i.aggressortype i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice i.cyberPersonal if cyberPersonal != ., vce(cluster caseid)
eststo severem5

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* By personal trait

* gender
quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
    task choice if female == 0, vce(cluster caseid)
eststo severemale

quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
    task choice if female == 1, vce(cluster caseid)
eststo severefemale

* education
quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
    task choice if college == 0, vce(cluster caseid)
eststo severenocollege

quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
    task choice if college == 1, vce(cluster caseid)
eststo severecollege

* major party divisions
quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
    task choice if democrat3 == 1, vce(cluster caseid)
eststo severedem

quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
    task choice if republican3 == 1, vce(cluster caseid)
eststo severegop

quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
    task choice if independent3 == 1, vce(cluster caseid)
eststo severeind

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* By view of personal threat

* Not at all worried
quietly reg severe i.target   b1.economic b1.death  ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice if cyberPersonal == 0, vce(cluster caseid)
eststo severepersonalm0

* Not very worried
quietly reg severe i.target   b1.economic b1.death  ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice if cyberPersonal == 1, vce(cluster caseid)
eststo severepersonalm1

* Somewhat worried
quietly reg severe i.target   b1.economic b1.death  ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice if cyberPersonal == 2, vce(cluster caseid)
eststo severepersonalm2

* Very worried
quietly reg severe i.target   b1.economic b1.death  ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice if cyberPersonal == 3, vce(cluster caseid)
eststo severepersonalm3

** Not at all or not very worrieed
quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 previewsevere previewnotsevere task choice if (cyberPersonal == 0 | cyberPersonal == 1), vce(cluster caseid)
eststo severepersonalm01


** Somewhat or very worried
quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 previewsevere previewnotsevere  task choice if (cyberPersonal == 3 | cyberPersonal == 2), vce(cluster caseid)
eststo severepersonalm23



* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* By view of cyber threat

* Not important or Important but Not Critical (only 240 in "Not Important"!)
quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice if (threatCyber == 0 | threatCyber == 1), vce(cluster caseid)
eststo severethreatm01

* Critical
quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice if threatCyber == 2, vce(cluster caseid)
eststo severethreatm2


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* Threat and Warmth

quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice ///
	 previewsevere previewnotsevere warmth ///
	 if aggressororigin != 5 & aggressororigin != 0, vce(cluster caseid)
eststo severecountrywarmth

quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice previewsevere previewnotsevere threat, vce(cluster caseid)
eststo severecountrythreat


quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice ///
	 previewsevere previewnotsevere  ///
	 if aggressororigin != 5 & aggressororigin != 0, vce(cluster caseid)
eststo severecountrybaseline

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* Most Responsible

* 0 Individuals
* 1 Internet Service Providers
* 2 Major Corporations
* 3 The Federal Government

gen federalmostresponsible = .
replace federalmostresponsible = 1 if cyberMostResponsible == 3
replace federalmostresponsible = 0 if cyberMostResponsible != 3 & cyberMostResponsible != .
lab def federalmostresponsiblelab 0 "Private Responsibility" 1 "Federal Responsibility"
lab val federalmostresponsible federalmostresponsiblelab
lab var federalmostresponsible "Federal Responsibility"

quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice previewsevere previewnotsevere ///
	 if federalmostresponsible==0, vce(cluster caseid)
eststo severefednotresponsible

quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.aggressororigin i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice previewsevere previewnotsevere ///
	 if federalmostresponsible==1, vce(cluster caseid)
eststo severefedresponsible


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* By country of origin


quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice previewsevere previewnotsevere ///
	 if aggressororigin==0, vce(cluster caseid)
eststo aggressorISR


quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice previewsevere previewnotsevere ///
	 if aggressororigin==1, vce(cluster caseid)
eststo aggressorIran


quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice previewsevere previewnotsevere ///
	 if aggressororigin==2, vce(cluster caseid)
eststo aggressorNORK


quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice previewsevere previewnotsevere ///
	 if aggressororigin==3, vce(cluster caseid)
eststo aggressorRUS


quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice previewsevere previewnotsevere ///
	 if aggressororigin==4, vce(cluster caseid)
eststo aggressorPRC


quietly reg severe i.target b1.economic b1.death ///
	i.aggressortype i.purpose  i.confidence i.indconcur ///
	i.policymakertype##i.policymakerconcur ///
	 white age college female i.pid7 task choice previewsevere previewnotsevere ///
	 if aggressororigin==5, vce(cluster caseid)
eststo aggressorUSA

******************************************
* Confidence Coefficient Plots And Tables
******************************************


* Presentation Plot (Figure 1 in Main Text)
#delim ;
coefplot (severem1, label(Baseline) offset(0.1)) (severem3, label("Demographics and Training") offset(-0.1)), ///
			drop(*.pid7 _cons preview* age white college female  task choice ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(30)) ///
		title("Respondents' Evaluation of Attack Severity") ///
		subtitle("OLS Coefficients Shown, Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(7) ysize(9) ///
		note("N = 12,290. Baseline includes experimental treatments only. Demographics and Training includes training vignette scores,"
		"controls for task number and profile side, as well as demographic and political participant variables.",size(tiny)) graphregion(margin(20 2 2 2))
;

#delim cr

graph export "${MyProject}/Severity2021Selected.png", replace

* Full Plot for Appendix
#delim ;
coefplot (severem1, label(Baseline) offset(0.1)) (severem3, label("Demographics and Training") offset(-0.1)), ///
			drop(_cons) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		white = "{bf: Demographics}" ///
		0.pid7 = "{bf:Party ID}" ///
		task = "{bf: Conjoint}" ///
		previewsevere = "{bf:Training Vignettes}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Respondents' Evaluation of Attack Severity") ///
		subtitle("OLS Coefficients Shown, Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(12) ysize(12) ///
		note("N = 12,290. Baseline includes experimental treatments only. Demographics and Training includes training vignette scores,"
		"controls for task number and profile side, as well as demographic and political participant variables.",size(tiny)) aspectratio(1.2) plotregion(margin(zero))
;

#delim cr
graph export "${MyProject}/Severity2021Full.png", replace


* By Gender
#delim ;
coefplot (severemale, label("Male") offset(0.1)) ///
			(severefemale, label("Female") offset(-0.1)), ///
			drop(*.pid7 _cons preview* age white college task choice ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Severity by Gender") ///
		subtitle("OLS Coefficients Shown, Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(12) ysize(10) ///
		note("N = 6,660 for Male and 5,650 for Female.",size(tiny)) aspectratio(1.2) plotregion(margin(zero))
;

#delim cr
graph export "${MyProject}/Severity2021Gender.png", replace


* By Party ID
#delim ;
coefplot (severegop, label("GOP") offset(0.1)) ///
			(severedem, label("Dem") offset(-0.1)) ///
			(severeind, label("Independent")), ///
			drop(*.pid7 _cons preview* age white college female republican7 task choice ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Severity by Party ID") ///
		subtitle("OLS Coefficients Shown, Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		xsize(12) ysize(10) ///
		legend(position(12) row(1)) ///
		note("N = 3,370 (GOP), 5,480 (Democrat), 3,480 (Independent).",size(tiny)) aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Severity2021PID.png", replace

* By Personal Worry
#delim ;
coefplot (severepersonalm01, label("Not at all/Not very worried") offset(0.1)) ///
			(severepersonalm23, label("Somewhat/Very worried") offset(-0.1)), ///
			drop(*.pid7 _cons preview* age white college female republican7 task choice ///
				*.indconcur *.target ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Severity by Worry about Personal Cyber Harms") ///
		subtitle("OLS Coefficients Shown, Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(12) ysize(10) ///
		note("N = 4,760 for Not/Not Very Worried and 7,430 for Somewhat/Very Worried.",size(tiny))  aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Severity2021PersonalWorry.png", replace


* By Threat and Warmth
#delim ;
coefplot (severecountrywarmth, label("Including Warmth") offset(0.1)) ///
			(severecountrythreat, label("Including Threat") offset(-0.1)) ///
			(severecountrybaseline, label("Baseline")), ///
			drop(*.pid7 _cons preview* age white college female warmth threat task choice ///
				*.indconcur *.purpose *.confidence ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		1.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Severity by Country Evaluation") ///
		subtitle("OLS Coefficients Shown, Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(14) ysize(10) ///
		note("N = 8,787 for warmth, 8,794 for baseline and threat.",size(tiny))  aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Severity2021ThreatWarmth.png", replace


* By Critical Threat
#delim ;
coefplot (severethreatm01, label("Not Important/Not Critical") offset(0.1)) ///
			(severethreatm2, label("Critical Threat") offset(-0.1)), ///
			drop(*.pid7 _cons preview* age white college task choice ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Severity by Threat Belief") ///
		subtitle("OLS Coefficients Shown, Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(12) ysize(10) ///
		note("N = 3,580 for Not Important or Important but not Critical; 8,710 for Critical.",size(tiny)) aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Severity2021CriticalThreat.png", replace



* By Responsibility
#delim ;
coefplot (severefedresponsible, label("Federal") offset(0.1)) ///
			(severefednotresponsible, label("Private") offset(-0.1)), ///
			drop(*.pid7 _cons preview* age white college female republican7 task choice ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Severity by Responsibility Belief") ///
		subtitle("OLS Coefficients Shown, Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(12) ysize(10) ///
		note("N = 5,910 for federal responsibility and 6,110 for private responsibility.",size(tiny)) aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Severity2021Responsibility.png", replace

* By Education
#delim ;
coefplot (severecollege, label("College") offset(0.1)) ///
			(severenocollege, label("No College") offset(-0.1)), ///
			drop(*.pid7 _cons preview* age white college female republican7 task choice ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Severity by Education") ///
		subtitle("OLS Coefficients Shown, Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(12) ysize(10) ///
		note("N = 6,540 for College and 5,790 for No College.",size(tiny)) aspectratio(1.2) plotregion(margin(zero)) 
;

#delim cr

graph export "${MyProject}/Severity202Education.png", replace




* By Country
#delim ;
coefplot (aggressorISR, label("Israel") offset(0.21)) ///
			(aggressorIran, label("Iran") offset(0.14)) ///
			(aggressorNORK, label("North Korea") offset(0.07))
			 (aggressorRUS, label("Russia") offset(0)) ///
			(aggressorPRC, label("PRC") offset(-0.07)) ///
			(aggressorUSA, label("USA") offset(-0.14)) , ///
			drop(*.pid7 _cons preview* age white college female warmth threat task choice ///
				*.indconcur *.purpose *.confidence ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		1.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Severity by Country of Origin") ///
		subtitle("OLS Coefficients Shown, Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(2)) ///
		xsize(12) ysize(10) ///
		note("Ns: 1,664 Israel, 2,547 Iran, 1,928 North Korea, 2,402 Russia, 1,917 China, 1,832 USA.",size(tiny)) aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Severity2021ByCountry.png", replace


graph close

******************************************
* Models of Retribution
******************************************

* Pooled and Separate Models by , , , , 
	* , Critical Threat, 
	
		
* * * * * * * * * * * * * * * * * * * * * * 
* Pooled and Separate Models
* * * * * * * * * * * * * * * * * * * * * *


* Ologit overall, unified
quietly ologit unifieddvalt i.aggressororigin i.target b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		female i.pid7 college white age task choice previewsevereresponse previewnotsevereresponse, vce(cluster caseid)
eststo ologitunifieddvalt

* Ologit overall, unified severe
quietly ologit unifieddvalt severe i.aggressororigin i.target b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		female i.pid7 college white age task choice previewsevereresponse previewnotsevereresponse, vce(cluster caseid)
eststo ologitunifieddvaltsevere

* Ologit overall, domestic only
quietly ologit domdvalt i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		female i.pid7 college white age task choice previewsevereresponse previewnotsevereresponse, vce(cluster caseid)
eststo ologitdomdv	

quietly ologit domdvalt severe i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		female i.pid7 college white age task choice previewsevereresponse previewnotsevereresponse, vce(cluster caseid)
eststo ologitdomdvsevere

* Ologit overall, international only		
quietly ologit intdvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		female i.pid7 college white age task choice previewsevereresponse previewnotsevereresponse, vce(cluster caseid)
eststo ologitintdv		
	
* Ologit overall, international only		
quietly ologit intdvalt severe i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		female i.pid7 college white age task choice previewsevereresponse previewnotsevereresponse, vce(cluster caseid)
eststo ologitintdvsevere		

* Graphing
                                               
* Select (Figure 2 in Main Text)
#delim ;
coefplot (ologitintdv, label("International") offset(0.1)) ///
			(ologitdomdv, label("Domestic") offset(-0.1)) ///
			(ologitunifieddvalt, label("Pooled")), ///
			drop(*.pid7 _cons preview* age white college female warmth threat task choice ///
				*.confidence 5.aggressororigin ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Preferences for Escalating Retaliation") ///
		subtitle("Ordinal Logistic Regression Coefficients Shown""Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(12) ysize(10) ///
		note("N = 12,289 for pooled, 1,832 for US/domestic, 10,457 for international.",size(tiny))  aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Retaliation2021Select.png", replace

* Full
#delim ;
coefplot (ologitunifieddvalt, label("Including Warmth") offset(0.1)) ///
			(ologitdomdv, label("Domestic Only") offset(-0.1)) ///
			(ologitunifieddvalt, label("Pooled")), ///
			drop(_cons) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Severity by Country Evaluation") ///
		subtitle("OLS Coefficients Shown, Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(16) ysize(12) ///
		note("N = 12,289 for pooled, 1,832 for US/domestic, 10,457 for international.",size(tiny))  aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Retaliation2021Full.png", replace

*** Full Results Tables (Appendix B.2)

esttab	ologitunifieddvaltsevere 	ologitdomdvsevere ologitintdvsevere ///
	using "${MyProject}/RetaliationSevereTables.tex", ///
	mtitles("Pooled" "Domestic" "International") varwidth(40) wrap ///
	label replace nobaselevels longtable ///
	title("Results including respondents' evaluations of severity"\label{tab:severetab}) ///
	interaction(" X ")  onecell compress 
	
* B.2 as an rtf
esttab	ologitunifieddvaltsevere 	ologitdomdvsevere ologitintdvsevere ///
	using "${MyProject}/RetaliationSevereTables", ///
	mtitles("Pooled" "Domestic" "International") varwidth(40) wrap ///
	label replace nobaselevels ///
	interaction(" X ")  onecell compress 	
	
* * * * * * * * * * * * * * * * * * * * * * 
* By Gender
* * * * * * * * * * * * * * * * * * * * * *


* Male
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 college white age task choice if female == 0, vce(cluster caseid)
eststo retaliationmale

* Female
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		 i.pid7 college white age task choice if female == 1, vce(cluster caseid)
eststo retaliationfemale	

	

* Graphing

* Select
#delim ;
coefplot (retaliationmale, label("Female") offset(0.1)) ///
			(retaliationfemale, label("Male") offset(-0.1)), ///
			drop(*.pid7 _cons preview* age white college female warmth threat task choice ///
				*.confidence ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Preferences for Escalating Retaliation by Gender") ///
		subtitle("Ordinal Logistic Regression Coefficients Shown""Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(13) ysize(10) ///
		note("N = 6,640 male, 5,649 female.",size(tiny))  aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Retaliation2021Gender.png", replace


		
* * * * * * * * * * * * * * * * * * * * * * 
* By PID
* * * * * * * * * * * * * * * * * * * * * *


* Republican
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		female college white age task choice if republican3 == 1, vce(cluster caseid)
eststo retaliationGOP

* Democrat
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		 female college white age task choice if democrat3 == 1, vce(cluster caseid)
eststo retaliationDEM	


* Independent
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		 female college white age task choice if independent3 == 1, vce(cluster caseid)
eststo retaliationIND	

	

* Graphing

* Select
#delim ;
coefplot (retaliationGOP, label("Republican") offset(0.1)) ///
			(retaliationIND, label("Independent") ) ///
						(retaliationDEM, label("Democrat") offset(-0.1)), ///

			drop(*.pid7 _cons preview* age white college female warmth threat task choice ///
				*.confidence ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Preferences for Escalating Retaliation by PartyID") ///
		subtitle("Ordinal Logistic Regression Coefficients Shown""Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(13) ysize(10) ///
		note("N = 3,370 Republican, 5,459 Democrats, 3,480 Independents.",size(tiny))  aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Retaliation2021PID.png", replace


		
* * * * * * * * * * * * * * * * * * * * * * 
* By College
* * * * * * * * * * * * * * * * * * * * * *


* College Degree
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female  white age task choice if college == 1, vce(cluster caseid)
eststo retaliationcollege

* No College Degree
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female  white age task choice if college == 0, vce(cluster caseid)
eststo retaliationnocollege



* Graphing

* Select
#delim ;
coefplot (retaliationcollege, label("College") offset(0.1)) ///
			(retaliationnocollege, label("No College") offset(-0.1)), ///

			drop(*.pid7 _cons preview* age white college female warmth threat task choice ///
				*.confidence ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Preferences for Escalating Retaliation byCollege") ///
		subtitle("Ordinal Logistic Regression Coefficients Shown""Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(13) ysize(10) ///
		note("N = 5,760 no college, 6,529 college.",size(tiny))  aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Retaliation2021College.png", replace


		
* * * * * * * * * * * * * * * * * * * * * * 
* By Warmth
* * * * * * * * * * * * * * * * * * * * * *


* Baseline
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if aggressororigin != 0 & aggressororigin != 5, vce(cluster caseid)
eststo retaliationbaseline

* Warmth
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice warmth if aggressororigin != 0 & aggressororigin != 5, vce(cluster caseid)
eststo retaliationwarmth


* Warmth
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice threat if aggressororigin != 0 & aggressororigin != 5, vce(cluster caseid)
eststo retaliationthreat

* Graphing

* Select
#delim ;
coefplot (retaliationwarmth, label("Warmth") offset(0.1)) ///
			(retaliationbaseline, label("Baseline") ) ///
			(retaliationthreat, label("Threat") offset(-0.1)), ///

			drop(*.pid7 _cons preview* age white college female warmth threat task choice ///
				*.confidence ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		1.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Preferences for Escalating Retaliation""by Warmth and Threat") ///
		subtitle("Ordinal Logistic Regression Coefficients Shown""Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(12) ysize(10) ///
		note("N = 8,793 baseline, 8,793 threat, 8,786 warmth.",size(tiny))  aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Retaliation2021Warmth.png", replace


		
* * * * * * * * * * * * * * * * * * * * * * 
* By Responsibility
* * * * * * * * * * * * * * * * * * * * * *


* Feds
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if federalmostresponsible == 1, vce(cluster caseid)
eststo retaliationfeds

* Private
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if federalmostresponsible == 0, vce(cluster caseid)
eststo retaliationprivate


* Graphing

* Select
#delim ;
coefplot (retaliationfeds, label("Feds") offset(0.1)) ///
			(retaliationprivate, label("Private") offset(-0.1)), ///

			drop(*.pid7 _cons preview* age white college female warmth threat task choice ///
				*.confidence ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Preferences for Escalating Retaliation""by Responsibility Belief") ///
		subtitle("Ordinal Logistic Regression Coefficients Shown""Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(12) ysize(10) ///
		note("N = 5,909 federal, 6,110 private.",size(tiny))  aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Retaliation2021Responsibility.png", replace


* * * * * * * * * * * * * * * * * * * * * * 
* By Cyber Threat
* * * * * * * * * * * * * * * * * * * * * *


* Not
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if (threatCyber == 0 | threatCyber == 1), vce(cluster caseid)
eststo retaliationnotimpt

* Critical
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if (threatCyber == 2), vce(cluster caseid)
eststo retaliationimpt


* Graphing

* Select
#delim ;
coefplot (retaliationnotimpt, label("Not Impt/Impt Not Critical") offset(0.1)) ///
			(retaliationimpt, label("Critical") offset(-0.1)), ///

			drop(*.pid7 _cons preview* age white college female warmth threat task choice ///
				*.confidence ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Preferences for Escalating Retaliation""by View of Cyber Threat") ///
		subtitle("Ordinal Logistic Regression Coefficients Shown""Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(12) ysize(10) ///
		note("N = 5,909 federal, 6,110 private.",size(tiny))  aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Retaliation2021CyberThreat.png", replace

		
* * * * * * * * * * * * * * * * * * * * * * 
* By Worry
* * * * * * * * * * * * * * * * * * * * * *


* Not
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if cyberPersonal == 0 | cyberPersonal == 1, vce(cluster caseid)
eststo retaliationnoworry

* Worried
quietly ologit unifieddvalt i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if cyberPersonal == 2 | cyberPersonal == 3, vce(cluster caseid)
eststo retaliationworry


* Graphing

* Select
#delim ;
coefplot (retaliationnoworry, label("Not/Not Very Worried") offset(0.1)) ///
			(retaliationworry, label("Somewhat/Very Worried") offset(-0.1)), ///

			drop(*.pid7 _cons preview* age white college female warmth threat task choice ///
				*.confidence ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Preferences for Escalating Retaliation""by Personal Cyber Worry") ///
		subtitle("Ordinal Logistic Regression Coefficients Shown""Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(13) ysize(10) ///
		note("N = 5,909 federal, 6,110 private.",size(tiny))  aspectratio(1.2) plotregion(margin(zero))
;

#delim cr
graph export "${MyProject}/Retaliation2021Personal.png", replace

		

		
* * * * * * * * * * * * * * * * * * * * * * 
* By Country
* * * * * * * * * * * * * * * * * * * * * *


* IRAN
quietly ologit unifieddvalt  i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if aggressororigin == 0, vce(cluster caseid)
eststo retaliationISRAEL

* Critical
quietly ologit unifieddvalt  i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if aggressororigin == 1, vce(cluster caseid)
eststo retaliationIRAN

quietly ologit unifieddvalt  i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if aggressororigin == 2, vce(cluster caseid)
eststo retaliationNORK

quietly ologit unifieddvalt  i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if aggressororigin == 3, vce(cluster caseid)
eststo retaliationRUS

quietly ologit unifieddvalt  i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if aggressororigin == 4, vce(cluster caseid)
eststo retaliationPRC

quietly ologit unifieddvalt  i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		i.pid7 female college white age task choice if aggressororigin == 5, vce(cluster caseid)
eststo retaliationUSA

* Graphing

* Select
#delim ;
coefplot (retaliationISRAEL, label("Israel") offset(0.21)) ///
			(retaliationIRAN, label("Iran") offset(0.14)) ///
			(retaliationNORK, label("North Korea") offset(0.07)) ///
			(retaliationRUS, label("Russia") offset(0.00)) ///
			(retaliationPRC, label("PRC") offset(-0.07)), ///
			drop(*.pid7 _cons preview* age white college female warmth threat task choice ///
				*.indconcur *.confidence ///
				1.policymakertype#2.policymakerconcur 0.policymakertype#0.policymakerconcur ///
				0.policymakertype#1.policymakerconcur 0.policymakertype#2.policymakerconcur ///
				1.policymakertype#0.policymakerconcur 1.policymakertype#1.policymakerconcur ///
				0.policymakertype 1.policymakertype 0.policymakerconcur 1.policymakerconcur ///
				2.policymakerconcur) xline(0) ///
headings (0.target = "{bf:Target}" 0.economic = "{bf:Economic}" ///
		0.death = "{bf:Deaths}" 0.confidence = "{bf:Intel Community Confidence}" ///
		0.aggressortype = "{bf:Aggressor Type}" ///
		0.aggressororigin = "{bf:Aggressor Origin}" ///
		0.purpose = "{bf:Purpose}" ///
		0.indconcur = "{bf:Independent Experts}" ///
		0.policymakertype = "{bf:Policymaker ID}" ///
		0.policymakerconcur = "{bf:Policymaker Cue}") ///
		coeflabels(,labsize(tiny) wrap(60)) ///
		title("Preferences for Escalating Retaliation""by Country of Origin") ///
		subtitle("Ordinal Logistic Regression Coefficients Shown""Standard Errors Clustered by Respondent",size(vsmall)) ///
		omitted baselevels ///
		legend(position(12) row(1)) ///
		xsize(13) ysize(10) ///
		note("N = 1664 (Israel), 2547 (Iran), 1927 (North Korea), 2402 (Russia), 1917 (PRC).",size(tiny))  aspectratio(1.2) plotregion(margin(zero))
;

#delim cr

graph export "${MyProject}/Retaliation2021AggressorCountry.png", replace



* * * * * * * * * * * * * * * * * * * * * * 
* Marginal Plots
* * * * * * * * * * * * * * * * * * * * * *

* Overall Marginal Plots
clonevar death2 = death
lab def death2lab 0 "None" 1 "One" 2 "Dozens" 3 "Hundreds"
lab val death2 death2lab

mylabels 0(10)60, myscale(@/100) local(myla)

quietly ologit domdvalt i.target   b1.economic b1.death2 i.confidence ///
		i.aggressortype i.purpose ///
		female i.pid7 college white age task choice, vce(cluster caseid)
margins death2, atmeans 

marginsplot, ///
	legend(order(1 "None" 2 "Condemn/Community Service" 3 "Sanctions/Fine" ///
				4 "Cyberespionage/Prison" 5 "Cyberattack/Life Sentence" ///
				6 "Airstrikes/Death Penalty") rows(2) position(12) ) ///
	title("Domestic", ///
			size(*1.2) span margin(medium)) ///
    ylab(`myla') ///
	ytitle("Predicted Probability") xtitle("")  ///
		 plot1opts(lpattern(".")) plot2opts(lpattern("--")) plot3opts(lpattern("_")) ///
		 plot4opts(lpattern("-_-")) plot5opts(lpattern("._.")) plot6opts(lpattern("_#_")) ///
	name(grdomestic, replace)

quietly ologit intdvalt i.target i.aggressororigin   b1.economic b1.death2 i.confidence ///
		i.aggressortype i.purpose ///
		female i.pid7 college white age task choice, vce(cluster caseid)
margins death2, atmeans 

* Figure 3 in Main Text
marginsplot, ///
	legend(order(1 "None" 2 "Condemn/Community Service" 3 "Sanctions/Fine" ///
				4 "Cyberespionage/Prison" 5 "Cyberattack/Life Sentence" ///
				6 "Airstrikes/Death Penalty") rows(2) position(12) ) ///
	title("International", ///
			size(*1.2) span margin(medium)) ///
    ylab(`myla') ///
	ytitle("Predicted Probability") xtitle("") ///
		 plot1opts(lpattern(".")) plot2opts(lpattern("--")) plot3opts(lpattern("_")) ///
		 plot4opts(lpattern("-_-")) plot5opts(lpattern("._.")) plot6opts(lpattern("_#_")) ///
	name(grinternational, replace) 

grc1leg grdomestic grinternational, position(12) ///
	title("Predicted Probability of Most Severe Response""By Experimental Manipulations")

gr export "${MyProject}/RetaliationPredictedProbabilities.png", replace
	
* Severity  Marginal Plots
mylabels 0(10)70, myscale(@/100) local(myla)

quietly ologit intdvalt severe i.aggressororigin i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		female i.pid7 college white age task choice previewsevereresponse previewnotsevereresponse, vce(cluster caseid)
margins, atmeans at(severe=(0(5)100))


marginsplot, recastci(rarea) recast(line) ///
	legend(order(1 "None" 2 "Condemn/Community Service" 3 "Sanctions/Fine" ///
				4 "Cyberespionage/Prison" 5 "Cyberattack/Life Sentence" ///
				6 "Airstrikes/Death Penalty") rows(2) position(12) ) ///
	title("International", ///
			size(*1.2) span margin(medium)) ///
    ylab(`myla') ///
	ytitle("Predicted Probability") xtitle("") ///
	name(grinternationalsevere, replace) 

mylabels 0(10)70, myscale(@/100) local(myla)

quietly ologit domdvalt severe i.target   b1.economic b1.death  i.confidence ///
		i.aggressortype i.purpose i.indconcur policymakertype##policymakerconcur ///
		female i.pid7 college white age task choice previewsevereresponse previewnotsevereresponse, vce(cluster caseid)
margins, atmeans at(severe=(0(5)100))

* Figure 4 in Main Text
marginsplot, recastci(rarea) recast(line) ///
	legend(order(1 "None" 2 "Condemn/Community Service" 3 "Sanctions/Fine" ///
				4 "Cyberespionage/Prison" 5 "Cyberattack/Life Sentence" ///
				6 "Airstrikes/Death Penalty") rows(2) position(12) ) ///
	title("Domestic", ///
			size(*1.2) span margin(medium)) ///
    ylab(`myla') ///
	ytitle("Predicted Probability") xtitle("") ///
	name(grdomesticsevere, replace) 
	

grc1leg grdomesticsevere grinternationalsevere, position(12) ///
	title("Predicted Probability of Most Severe Response""By Evaluations of Severity")
	
gr export "${MyProject}/RetaliationPredictedProbabilitiesSevere.png", replace


* * * * * * * * * * * * * * * * * * * * * * 
* Descriptives for Appendix
* * * * * * * * * * * * * * * * * * * * * *

clonevar target2 = target
lab def target2lab 0 "Corporations" 1 "Banks" 2 "Hospitals" 3 "Power Grid" 4 "Military"
lab val target2 target2lab 

***********
* International (Figure B.1)


* By deaths

tabplot death intnothing, percent(death) showval /// 
	title("Do Nothing") xtitle("") ytitle("") subtitle("") ///
	name(grintnothin,replace)


tabplot death diplomatic, percent(death) showval /// 
	title("Condemn") xtitle("") ytitle("") subtitle("") ///
	name(grdiplomatic,replace)

tabplot death sanctions, percent(death) showval /// 
	title("Sanctions") xtitle("") ytitle("") subtitle("") ///
	name(grsanctions,replace)
	

tabplot death cyberespionage, percent(death) showval /// 
	title("Cyber Espionage") xtitle("") ytitle("") subtitle("") ///
	name(grcyberespionage,replace)


tabplot death cyberattack, percent(death) showval /// 
	title("Cyber Attack") xtitle("") ytitle("") subtitle("") ///
	name(grcyberattack,replace)

	
tabplot death airstrikes, percent(death) showval /// 
	title("Airstrikes") xtitle("") ytitle("") subtitle("") ///
	name(grairstrikes,replace)
	
gr combine grintnothin grdiplomatic grsanctions grcyberespionage ///
	grcyberattack grairstrikes, ///
	rows(3) title("Frequency of Responses" "to Retaliatory Options by Casualties (International)") ///
		xsize(8) ysize(10) 
gr export "${MyProject}/ResponseInternationalFrequencyTabplot.png", replace





***********
* Domestic (Figure B.2)

* By deaths


tabplot death domnothing, percent(death) showval /// 
	title("Do Nothing") xtitle("") ytitle("") subtitle("") ///
	name(grdomnothing,replace)

tabplot death fine, percent(death) showval /// 
	title("Impose a Fine") xtitle("") ytitle("") subtitle("") ///
	name(grfine,replace)

tabplot death communitysvc, percent(death) showval /// 
	title("Community Service") xtitle("") ytitle("") subtitle("") ///
	name(grcommunitysvc,replace)
	
tabplot death prison, percent(death) showval /// 
	title("Prison") xtitle("") ytitle("") subtitle("") ///
	name(grprison,replace)

tabplot death lifesentence, percent(death) showval /// 
	title("Life Sentence") xtitle("") ytitle("") subtitle("") ///
	name(grlifesentence,replace)
	
tabplot death deathpenalty, percent(death) showval /// 
	title("Death Penalty") xtitle("") ytitle("") subtitle("") ///
	name(grdeathpenalty,replace)
	
gr combine grdomnothing grfine grcommunitysvc grprison grlifesentence ///
	grdeathpenalty , ///
	rows(3) title("Frequency of Responses""to Retaliatory Options by Casualties (Domestic)")  ///
		xsize(8) ysize(10) 

gr export "${MyProject}/ResponseDomesticFrequencyTabplot.png", replace

	
